package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the NOTAFISCAL database table.
 * 
 */
@Entity
@NamedQuery(name="Notafiscal.findAll", query="SELECT n FROM Notafiscal n")
public class Notafiscal implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="ID_NOTAFISCAL")
	private long idNotafiscal;

	@Temporal(TemporalType.DATE)
	@Column(name="DATA_EMISSAO")
	private Date dataEmissao;

	@Temporal(TemporalType.DATE)
	@Column(name="DATA_ENTRADA")
	private Date dataEntrada;

	private String total;

	//bi-directional many-to-one association to DetalheNotafiscal
	@OneToMany(mappedBy="notafiscal")
	private List<DetalheNotafiscal> detalheNotafiscals;

	//bi-directional many-to-one association to Cfop
	@ManyToOne
	@JoinColumn(name="ID_CFOP")
	private Cfop cfop;

	public Notafiscal() {
	}

	public long getIdNotafiscal() {
		return this.idNotafiscal;
	}

	public void setIdNotafiscal(long idNotafiscal) {
		this.idNotafiscal = idNotafiscal;
	}

	public Date getDataEmissao() {
		return this.dataEmissao;
	}

	public void setDataEmissao(Date dataEmissao) {
		this.dataEmissao = dataEmissao;
	}

	public Date getDataEntrada() {
		return this.dataEntrada;
	}

	public void setDataEntrada(Date dataEntrada) {
		this.dataEntrada = dataEntrada;
	}

	public String getTotal() {
		return this.total;
	}

	public void setTotal(String total) {
		this.total = total;
	}

	public List<DetalheNotafiscal> getDetalheNotafiscals() {
		return this.detalheNotafiscals;
	}

	public void setDetalheNotafiscals(List<DetalheNotafiscal> detalheNotafiscals) {
		this.detalheNotafiscals = detalheNotafiscals;
	}

	public DetalheNotafiscal addDetalheNotafiscal(DetalheNotafiscal detalheNotafiscal) {
		getDetalheNotafiscals().add(detalheNotafiscal);
		detalheNotafiscal.setNotafiscal(this);

		return detalheNotafiscal;
	}

	public DetalheNotafiscal removeDetalheNotafiscal(DetalheNotafiscal detalheNotafiscal) {
		getDetalheNotafiscals().remove(detalheNotafiscal);
		detalheNotafiscal.setNotafiscal(null);

		return detalheNotafiscal;
	}

	public Cfop getCfop() {
		return this.cfop;
	}

	public void setCfop(Cfop cfop) {
		this.cfop = cfop;
	}

}